#include "StdAfx.h"
#include "ChunkCamera.h"
#include "ChunkSpace.h"
#include "ChunkManager.h"

/*
#include <Common/Base/hkBase.h>

// Physics
#include <Physics/Dynamics/World/hkpWorld.h>
#include <Physics/Collide/Dispatch/hkpAgentRegisterUtil.h>
#include <Physics/Dynamics/Entity/hkpRigidBody.h>
#include <Physics/Collide/Shape/Convex/Sphere/hkpSphereShape.h>
*/


using namespace ChunkSystem;

ChunkCamera::ChunkCamera(void)
	:m_pCurChunkSpace(NULL),m_pCurChunk(NULL),m_pCameraRigid(NULL)
{
	ChunkSpace* pSpace = ChunkManager::GetInstance().GetCurChunkSpace();
	if( pSpace != NULL )
	{
		float fGridResolution = pSpace->GetGridResolution();
		m_fLoadingRange = 3 * fGridResolution;
		m_fHoldingRange = m_fLoadingRange + 3 * fGridResolution;
	}
	else
	{
		m_fLoadingRange = 200.0f;
		m_fHoldingRange = m_fLoadingRange + 200.0f;
	}

	/*
	hkpWorld* pPhysicsWorld = ChunkManager::GetInstance().GetCurPhysicsWorld();
	if( pPhysicsWorld != NULL )
	{
		pPhysicsWorld->markForWrite();

		hkpSphereShape* pCameraSphere = new hkpSphereShape(2.0f);
		hkpRigidBodyCinfo infoRigid;
		infoRigid.m_shape = pCameraSphere;
		infoRigid.m_mass = 1.0f;

		m_pCameraRigid = new hkpRigidBody(infoRigid);
		pPhysicsWorld->addEntity( m_pCameraRigid );

		pCameraSphere->removeReference();

		pPhysicsWorld->unmarkForWrite();
	}
	*/
}

ChunkCamera::~ChunkCamera(void)
{
	/*
	hkpWorld* pPhysicsWorld = ChunkManager::GetInstance().GetCurPhysicsWorld();
	if( pPhysicsWorld != NULL && m_pCameraRigid != NULL )
		pPhysicsWorld->removeEntity( m_pCameraRigid );
		*/
}
